package it.txt.ens.authorisationService.gui.standalone.util;


import java.io.*;
/**
 * Redirect the incoming stream to Java's standard output (i.e. console)
 * 
 */

public class StandardOutStreamForwarder extends Thread
{
    private InputStream inputStream = null;
//    private boolean isError;

    
    public StandardOutStreamForwarder(InputStream is, boolean isError)
    {
        this.inputStream = is;
        //at the moment this is ignored
//        this.isError = isError;
    }

    public void run()
    {
        try
        {
            InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
            BufferedReader bufferReader = new BufferedReader(inputStreamReader);
            String line = null;
//            if (isError) {
//            	System.out.println("ERROR!");
		        while ( (line = bufferReader.readLine()) != null)
		            System.out.println(line);
//            } else {
//		        while ( (line = bufferReader.readLine()) != null)
//		            System.out.println(line);
//            } 
        } catch (IOException e)
          {
            e.printStackTrace();  
          }
    }
}

